using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace Pervote.Core.Logic
{
    public static class HtmlHelper
    {
        public static string Sanitize(string input)
        {
            return Sanitize(input, 0);
        }

        public static string Sanitize(string input, int maxLength)
        {
            //We will reserve the tilde for our use.
            input.Replace("~", "-");
            input = input.Replace("<", "&lt;");
            input = input.Replace(">", "&gt;");
            if (maxLength > 0 && input.Length > maxLength)
            {
                input = input.Substring(0, maxLength);
            }
            return input;
        }
    }
}
